import java.util.Objects;

class Fruits{
    String name;

    public Fruits(String name){
        this.name = name;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Fruits fruits = (Fruits) o;
        return Objects.equals(name, fruits.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name);
    }

    @Override
    public String toString() {
        return "Fruits{" +
                "name='" + name + '\'' +
                '}';
    }
}


public class Text {
    public static void main(String[] args) {
        Fruits fruits1 = new Fruits("apples");
        Fruits fruits2 = new Fruits("apples");
        HashBuck<Fruits,Integer> hashBuck = new HashBuck<>();
        hashBuck.put(fruits1,1);
        //hashBuck.put(fruits2,2);
        System.out.println(hashBuck.get(fruits2));
    }
}
